{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "3480be0a-06ac-4cfd-89d5-c1b0650bdeb7",
   "metadata": {},
   "source": [
    "# Analysis of Competing Risks\n",
    "\n",
    "In classical survival analysis, the focus is on the time until a specific event occurs. If no event is observed during the study period, the time of the event is considered censored. A common assumption is that censoring is non-informative, meaning that censored subjects have a similar prognosis to those who were not censored.\n",
    "\n",
    "Competing risks arise when each subject can experience an event due to one of $K$ ($K \\geq 2$) mutually exclusive causes, termed competing risks. Thus, the occurrence of one event prevents the occurrence of other events. For example, after a bone marrow transplant, a patient might relapse or die from transplant-related causes (transplant-related mortality). In this case, death from transplant-related mortality precludes relapse.\n",
    "\n",
    "The bone marrow transplant data from [Scrucca et al., Bone Marrow Transplantation (2007)](https://doi.org/10.1038/sj.bmt.1705727) includes data\n",
    "from 35 patients grouped into two cancer types: Acute Lymphoblastic Leukemia (ALL; coded as 0), and Acute Myeloid Leukemia (AML; coded as 1)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e50590a8-71ba-4aaa-af4d-54b0cb2bf025",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dis</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AML</th>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ALL</th>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     count\n",
       "dis       \n",
       "AML     18\n",
       "ALL     17"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "from sksurv.datasets import load_bmt\n",
    "\n",
    "bmt_features, bmt_outcome = load_bmt()\n",
    "\n",
    "diseases = bmt_features[\"dis\"].cat.rename_categories({\"0\": \"ALL\", \"1\": \"AML\"})\n",
    "\n",
    "diseases.value_counts().to_frame()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ac783fc7-2f87-4c5a-9713-53ea88f69fc5",
   "metadata": {},
   "source": [
    "During the follow-up period, some patients might experience a relapse of the original leukemia or die\n",
    "while in remission (transplant related death).\n",
    "The outcome is defined similarly to standard time-to-event data, except that the event indicator specifies the type of event, where 0 always indicates censoring."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "cc2aea08-e363-4241-a3d3-8e794ad2d06b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>label</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Relapse</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Censored</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Transplant related mortality</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              count\n",
       "label                              \n",
       "Relapse                          15\n",
       "Censored                         11\n",
       "Transplant related mortality      9"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "status_labels = {\n",
    "    0: \"Censored\",\n",
    "    1: \"Transplant related mortality\",\n",
    "    2: \"Relapse\",\n",
    "}\n",
    "\n",
    "risks = pd.DataFrame.from_records(bmt_outcome).assign(label=lambda x: x[\"status\"].replace(status_labels))\n",
    "\n",
    "risks[\"label\"].value_counts().to_frame()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e382c51-5dd7-4c03-8312-bb46b91d263d",
   "metadata": {},
   "source": [
    "The table above shows the number of observations for each status."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "41bf3ed1-d63e-4584-8bff-e43c86003800",
   "metadata": {},
   "source": [
    "## Non-parametric Estimator of the Cumulative Incidence Function\n",
    "\n",
    "If the goal is to estimate the probability of relapse, transplant-related death is a competing risk event. This means that the occurrence of relapse prevents the occurrence of transplant-related death, and vice versa. We aim to estimate curves that illustrate how the likelihood of these events changes over time.\n",
    "\n",
    "Let's begin by estimating the probability of relapse using the complement of the Kaplan-Meier estimator. With this approach, we treat deaths as censored observations. One minus the Kaplan-Meier estimator provides an estimate of the probability of relapse before time $t$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4490907c-71d3-42b1-951e-d3dc623296c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAERCAYAAAB/4wAeAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAALEwAACxMBAJqcGAAAHvZJREFUeJzt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SAwDAA4kBAOCBxAA8hu6Ynjp1qrtdt25dn7yO7nj++uuvffK9gdQiMQCpSAxbtmzxyetouQat4wPYAYkBeIzhw4fL4cOHTcnuIUOGSO7cuc19rWekp4K9+eabUqZMGVNIcM2aNVKvXj1z2pYWlXOZO3euOUFOv0efPn1MCfD7K5VqvSmth6TPOXLkiN//nIAHvxTeAALU/Ycm5cqVy30/KCjI2rt3r3Xv3j2rWrVqVo8ePcyhMEuWLDF1eVR8fLz12muvmZPjVL9+/awvv/zygddp1qyZtW/fPr/9uYDH+f30DwCp9tJLL5lzj5WeJd24cWNTL1/vaY/CNUQUFxdnKvq6qrs+rHSyVgDVHghgByQGII1y5Mjhfqwnrrna+th1foLWqOzevbspqf0oFy5ckODgYPcpbUBGY44BeIw8efK4zx5IC+1F6NzBuXPnTPvSpUty7Ngxj+do7+LFF1986liB9EJiAB6jYMGCZkJZD6LRyefU0oNhxo4da85Hrly5sjlv2nUil4sOIWmvQV/DV6uegNTgPAYAgAd6DAAADyQGAIAHEgMAwAOJAQDggcQAAPBAYgAAeCAxAAA8kBgAAJLS/wHab+kTYjzVlAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from sksurv.nonparametric import kaplan_meier_estimator\n",
    "\n",
    "times, km_estimate = kaplan_meier_estimator(bmt_outcome[\"status\"] == 1, bmt_outcome[\"ftime\"])\n",
    "\n",
    "plt.step(times, 1 - km_estimate, where=\"post\")\n",
    "plt.xlabel(\"time $t$\")\n",
    "plt.ylabel(\"Probability of relapsing before time $t$\")\n",
    "plt.ylim(0, 1)\n",
    "plt.grid()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22b3e5ac-324c-40f8-aa0f-b747f607a68d",
   "metadata": {},
   "source": [
    "However, this approach has a significant drawback: considering death as a censoring event violates the assumption that censoring is non-informative. This is because patients who died from transplant-related mortality have a different prognosis than patients who did not experience any event. Therefore, the estimated probability of relapse is often biased.\n",
    "\n",
    "The cause-specific **cumulative incidence function (CIF)** addresses this problem by estimating the cause-specific hazard of each event separately. The cumulative incidence function estimates the probability that the event of interest occurs before time $t$, and that it occurs before any of the competing causes of an event. In the bone marrow transplant dataset, the cumulative incidence function of relapse indicates the probability of relapse before time $t$, given that the patient has not died from other causes before time $t$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2fcf9bdc-8ec4-4e19-a372-1f2f669c7803",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAERCAYAAAB/4wAeAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAALEwAACxMBAJqcGAAAK6JJREFUeJzt3Qd4U/X6B/CXzRVZrTJk1zLLLEumIAJSFERBQARkCCKCXr2I4y8ooiAoiiwvw4rKElRAFBAQFARkb+EyyirKKgXKZRQ4/+f7ck9MQqFp2iQnOd/P8+RpTpqcvOnIm996f5kMwzCEiIjofzKbV4iIiICJgYiIXDAxEBGRCyYGIiJywcRAREQumBiIiCgwiaF79+5SoEABqVixYorfx6zZ/v37S2RkpFSuXFk2bdrkr9CIiCgQieHpp5+WRYsW3fL7CxculL179+pl4sSJ0qdPH3+FRkREgUgMDRs2lLCwsFt+f968edKlSxfJlCmT3HfffZKYmCh//vmnv8IjIiKrjTHEx8dLsWLFHMdFixbV24iIyL+yShBCVxMusGvXLpeEkhbXr1+XzJktkxtDIlbGac84gylWxnnD6dOn5dSpU5Iiw4/i4uKMqKioFL/Xq1cvY/r06Y7jMmXKGMeOHUv1nNWrV/c6nuXLlxvBIlhiZZz2jDOYYmWcqb93WiZttmrVSr744gudnbR27VrJmzevFC5cONBhERHZjt+6kjp27CgrVqzQpgvGD95++21JTk7W7z377LMSExMj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ZEm10dLTGCIGK1ZaJwZPyHFbiXCoEX1u3bh3okLQcOlaqY6bHSy+9ZOlYUYwMb65w8eJFWbJkicaNBIHSK1aJddiwYfrGj645/E2iJMy0adMsFye6Y86fP++4/tNPP+ksOqv97tH1gi5jzPgBlPHHLDqrxekM+9SY3UgQsFgNm/rhhx90Jg1mJw0dOtSwig4dOhiFChUysmbNahQpUsSYPHmycerUKR2QjIyMNJo0aWKcPn060GEaK1euxMJIo1KlSkaVKlX0gp+pFWPdunWrUbVqVY0Vg/pvv/223o5ZaTVr1jTuvfdeo23btsalS5cMq1i+fLljVpLV4kQ8mMmHS4UKFRz/P1b83W/evNmoXr26/u5bt25tJCQkWDJOSEpKMsLCwnTQ3BSoWLnymYiIXNiyK4mIiG6NiYGIiFwwMRARkQsmBiIicsHEQERELpgYiIjIBRMDERG5YGIgug2smB4/frzjuG7duj55Hqx4njVrlk/OTZRWTAxEaUgMq1ev9snzoFwD6vgQWQETA9FtvPrqq7J//34t2T1gwAC588479XbUM8KuYE8//bSUKVNGCwkuXbpU6tWrp7ttoaic6auvvtId5HCO3r17awlw90qlqDeFeki4z4EDB/z+Oolc+KXwBlGQct80KVeuXI7bs2TJYmzbts24du2aER0dbXTr1k03hZk7d67W5YFdu3YZDz/8sO4cB3369DGmTp160/M0b97c2L59u99eF9Ht3Nj9g4jSrFSpUrrvMWAv6SZNmmi9fNyGFoXZRbRx40at6GtWd02pdDIqgKIFQmQFTAxEXsqRI4fjOnZcM49x3dw/ATUqu3btqiW1b+XUqVOSN29exy5tRIHGMQai28idO7dj7wFvoBWBsYMTJ07ocUJCghw6dMjlPmhd3HPPPemOlSijMDEQ3UZ4eLgOKGMjGgw+pxU2hhk6dKjuj1y5cmXdb9rckcuELiS0GvAcvpr1RJQW3I+BiIhcsMVAREQumBiIiMgFEwMREblgYiAiIhdMDERE5IKJgYiIXDAxEBGRCyYGIiISZ/8P7O/MJaoNv1IAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sksurv.nonparametric import cumulative_incidence_competing_risks\n",
    "\n",
    "times, cif_estimates = cumulative_incidence_competing_risks(bmt_outcome[\"status\"], bmt_outcome[\"ftime\"])\n",
    "\n",
    "plt.step(times, cif_estimates[0], where=\"post\", label=\"Total risk\")\n",
    "for i, cif in enumerate(cif_estimates[1:], start=1):\n",
    "    plt.step(times, cif, where=\"post\", label=status_labels[i])\n",
    "plt.legend()\n",
    "plt.xlabel(\"time $t$\")\n",
    "plt.ylabel(\"Probability of event before time $t$\")\n",
    "plt.ylim(0, 1)\n",
    "plt.grid()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3fe703d7-e106-41da-9abd-79e4004afc21",
   "metadata": {},
   "source": [
    "The plot shows the estimated probability of experiencing an event at time $t$ for both the individual risks and for the total risk."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "50e9ea6d-5357-4bbb-aaff-d0ccb5180314",
   "metadata": {},
   "source": [
    "Next, we want to to estimate the cumulative incidence curves for the two cancer types — acute lymphoblastic leukemia (ALL) and acute myeloid leukemia (AML) — to examine how the probability of relapse depends on the original disease diagnosis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6ce2f5ca-887b-43f1-b655-d71b6cff3ec6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb0AAAGJCAYAAAAexe3/AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAALEwAACxMBAJqcGAAAQc1JREFUeJzt3Qd0VNX6NvD3QihXxEAooiGUGGmREop0BJGqRlCaNKXcSBFsVxG4BAygUWxI0yAElSYqEkQBIRClhyYdBBIgCS0QWigBwnzref/fjJOQMgnT5/mtddbMOXPmnJ3J7HnP3meXfxkMBoMQERF5g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urJTh/f39d79Gjh0RFRWUIelhHKRK6dOkir776qgZcnJ+IiMhuDVkQ7DCJLEpo+ZGUlCR+fn6mdZT20DAmu328vLzE29tbzp8/L6VL579fT7Eizt+aiMjVMY+R2wU9BKi5c+dKpUqVtAWnsQS2e/dusbeIiAhd4ODBgzkOh5acnCxlypQRV8I0e16aHX3/mnnK+TDNtslTFge9lStX3lMCfH19JSEhwbSemJio27LaB6XA27dv65x9pUrdfQWJ/oFYLIHMu23bNnElTLN9uGKabYV5yvkwzbbhZck8el9++aU2LsE4nGixiarHvEK16OHDhyU+Pl6DGxqqYHoic2jY8s0332j/vx9//FGefPJJ3s8jIiKryTV6vfTSS1KoUCEddmz58uU6vRBGZ8nziby8ZOrUqdKuXTttydm/f38JDAyU0NBQvTpAwENAxRx9aPDi4+OjgZGIiMhuQQ9BDq02AUHp8ccfz/fJ0AIUi7mwsDDT86JFi1p9UlpLq2ycCdNsH66YZmfgip8b02wfIS6Q5n8ZchlWBa02d+zYke06ERGRq8g16GG4MeN4m9j1+vXrct9995lab16+fNleaSUiIrLtMGS4/4bAhuXKlSvaqtL43NkDXm7DnjkaWqq2atVKO+jj/qbxXmlKSoq0adNGHn30UX28cOGCOBt8LzAizzPPPKPraKCEoePwWWMouZs3b4ozuXjxog54gImPq1evLps2bXKJz9nZME/ZDvOUk4296WqMw54ZG98sWLBAH50JGvd88sknmq7NmzfLtGnT9Dl+TFq3bq2tXfHojD8u+DHBF90IQ8a98cYb2soXQ8lhSDln8tprr0n79u21DxrmhUTaXeFzdibMU7bFPGUnBje1ceNGQ9u2bU3r77//vi7OLDg42PD7778bqlSpYjh58qRuwyPWnUlCQoLhySefNERHRxuefvppw507dwylSpUy3Lp1K8vP3tEuXrxoqFSpkqbTnLN/zs6Gecp2mKfsx21LelkNe4ZtzgqjB+zcuVOrM86cOSMPPfSQbi9XrpyuO5PXX39dPvroIylQ4P++PhgqrkSJEqb+m872WaOaCKNEYKYQVB8NHDhQrl696vSfs7NhnrId5in7cdug50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27at1KpVS9q0aWOaIdkIVTC4MsU5bNWSjchZME+5Js6nR0REHoMlPSIi8hgMekRE5DEY9IiIyGMw6BERkcdg0CMiIo/BoEdERB6DQY+IiDwGgx4REYmn+H9rHeUCHUVfXQAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 504x432 with 4 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "_, axs = plt.subplots(2, 2, figsize=(7, 6), sharex=True, sharey=True)\n",
    "\n",
    "for j, disease in enumerate(diseases.unique()):\n",
    "    mask = diseases == disease\n",
    "\n",
    "    event = bmt_outcome[\"status\"][mask]\n",
    "    time = bmt_outcome[\"ftime\"][mask]\n",
    "    times, cif_estimates, conf_int = cumulative_incidence_competing_risks(\n",
    "        event,\n",
    "        time,\n",
    "        conf_type=\"log-log\",\n",
    "    )\n",
    "\n",
    "    for i, (cif, ci, ax) in enumerate(zip(cif_estimates[1:], conf_int[1:], axs[:, j]), start=1):\n",
    "        ax.step(times, cif, where=\"post\")\n",
    "        ax.fill_between(times, ci[0], ci[1], alpha=0.25, step=\"post\")\n",
    "        ax.set_title(f\"{disease}: {status_labels[i]}\", size=\"small\")\n",
    "        ax.grid()\n",
    "\n",
    "for ax in axs[-1, :]:\n",
    "    ax.set_xlabel(\"time $t$\")\n",
    "for ax in axs[:, 0]:\n",
    "    ax.set_ylim(0, 1)\n",
    "    ax.set_ylabel(\"Probability of event before time $t$\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf7e71a4-dba5-42cf-8161-ac16efbe38e1",
   "metadata": {},
   "source": [
    "The left column shows the estimated cumulative incidence curves (solid lines) for patients diagnosed with ALL, while the right column shows the curves for patients diagnosed with AML, along with their 95% pointwise confidence intervals. The plot indicates that the estimated probability of relapse at $t=40$ days is more than three times higher for patients diagnosed with ALL compared to AML."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
